package com.telecom;

import com.telecom.service.impl.UserServiceImpl;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * Hello world!
 */
public class App {
    public static void main(String[] args) {
       /* UserDao dao=new UserDaoMybatisImpl();
        UserDao dao1=new UserDaoJdbcImpl();
        UserServiceImpl userService = new UserServiceImpl();
        userService.setDao(dao1);
        userService.insert();*/


        //相当于我们自己写的Factory
        ApplicationContext context=new ClassPathXmlApplicationContext("bean.xml");
        UserServiceImpl bean = context.getBean(UserServiceImpl.class);
        for (String address : bean.getAddresses()) {
            System.out.println(address);
        }
       // bean.insert();
        //UserDao dao = (UserDao) context.getBean("dao");
       /* UserDao dao=context.getBean(UserDaoJdbcImpl.class);
        dao.save();*/

    }
}
